DiskReader

DiskReader is a short, concise piece of code which contains all the basic requirements of a system friendly disk imager. All you have to do is insert an include diskreader.asm at the top of your program. The general concept is that you read one track, decode it, save it, read another and so on. This track is either DOS readable or held in a raw format that is word-synchronized, this covers 99% of disk formats used in games. You can either write to a single diskfile, or write several files. Diskreader may seem restricitive, and it is - but there are very few disk reading requirements which cannot be solved this way. If you need an extra feature (like seeking backwards in the disk file, saving several files in more than one chunk) then simply add the required code yourself in the ripper, I quite allow it.

download diskreader.asm, or adfreader.asm which is a 100% compatible replacement for diskreader, except that it sources data from an ADF disk image file, rather than the trackdisk device.

Writing installers with diskreader

Initial decisions: diskreader.asm has some special flags which you can define before including it. To specify, for example, FILEMODE to be on, write FILEMODE=1 in your code. To prevent switching on FILEMODE, either write FILEMODE=0, or simply do not write it. Now include diskreader.asm. You can now start writing code to read the disk. For example,
        WRITEDOS #0
        WRITEDOS #1

        moveq   #2,d7   ; d7 = tracknumber
.nxttrk RAWREAD d7      ; read track
        RESYNC  #$9521  ; resync track
        bsr     decode  ;... not included
        beq.s   .ok     ; checksum ok?
FAILURE cksum(pc)
.ok     WRITE   #6800
        addq.w  #1,d7
        cmp.w   #160,d7
        bne.s   .nxttrk
        rts

cksum   dc.b    'bad checksum',0
This program reads tracks 0 and 1 as normal DOS tracks, and writes them to the diskfile as 5632 bytes each, then reads all the other tracks as raw tracks with wordsync=$9521, writing them to the diskfile as 6800 bytes each. If decoding fails, the user sees the message "bad checksum: not a DOS disk". As you can see, the reading and writing of disk data is very simple, so the majority of the code will be the task of decoding the disk data, which was not included in that example.

Major concepts

Command reference

Examples


Kyzer/CSG